home *** CD-ROM | disk | FTP | other *** search
-
-
-
- #define ACK_BIT 128 /* keyboard acknowledge bit */
- #define HOT_Key 30 /* scan code for toggle key */
-
- static void interrupt (*old_int)(); /* original int 0x09 */
- static int toggle; /* Toggled value */
-
- void interrupt my_interrupt() /* ours */
- {
- unsigned char scan_code, ack;
-
- scan_code = inportb(0x60); /* scan code from 8255 PIC */
- if (scan_code == HOT_Key) /* the one we watch */
- {
- toggle ^= 1; /* our toggle */
- scan_code = inportb(0x61); /* control port */
- outportb(0x61,scan_code | ACK_BIT);
- /* send keyboard ACK */
- outportb(0x61,scan_code); /* clear ack*/
-
- outportb(0x20,0x20); /* enable hardware interrupts */
- }
- else
- (*old_int)(); /* normal processing */
- }
-
- void install()
- {
- old_int = _getvect(0x9); /* save old one */
- _setvect(0x9,my_interrupt); /* install new one */
- }
-
- void remove()
- {
- _setvect(0x9,old_int); /* restore original state */
- }
-
-